"use strict";
// pages/product/info.js
var common = require('../../../utils/api.js')
var api = common.api
var util = require('../../../utils/util.js')
Page({
  onShareAppMessage:function(){
    var title = this.data.qrcode.product.title
    var url = "pages/index/join/join?pid="+this.data.pid
    console.log(10,title,url)
    return {
      title: title,
      path: url,
      success: function(res) {
        // 转发成功
      },
      fail: function(res) {
        // 转发失败
      }
    }
  },
  data:{
    product:{},
    headTitle:'项目详情',
    productstatus:util.productstatus,
    statusselect:'',
    pid:'',
    qrcode:{}
  },
  onShow:function(options){

  },
  onReady:function(){
    // 页面渲染完成
  },
  onLoad:function(options){
    // 页面显示
        util.showLoading({title: '加载中'})
    var that = this
    this.data.pid = options.pid
    // 页面初始化 options为页面跳转所带来的参数
    api.getqrcode(options.pid,function(result){
      console.log('getProductInfo',result,that.productstatus,that.headTitle)
      //更新数据
      that.setData({qrcode:result})
      util.hideLoading()
    })
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  },
  mapData:function(result){
    result.manager = util.getSelectmanage(result.manager)
    result.teamleader = util.getSelectteamleaderslistJoin(result.teamleader)
    result.statusselect=util.productstatus[result.status-1].name
  }
})